package com.gitee.jjnnzb.designpatterndemo.handler.impl;

import com.gitee.jjnnzb.designpatterndemo.handler.UrlHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

/**
 * @author Jjn
 * @since 2023/3/7 16:11
 */
@Component
@Slf4j
@Order(value = 11)
public class WeiboArticleHandler implements UrlHandler {
    @Override
    public boolean apply(String url) {
        if (!StringUtils.hasText(url)) {
            return false;
        }
        return url.contains("weibo.com/ttarticle");
    }
    
    @Override
    public void handle(String url) {
        if (log.isInfoEnabled()) {
            log.info("url:{}是微博文章链接,执行微博文章处理策略", url);
        }
    }
}
